import { get, post } from '@/utils/request';
import {SysUser} from "@/api/system/user.ts";
import {SysRole} from "@/api/system/role.ts";

interface LoginParams {
    username: string;
    password: string;
}

export interface LoginResponse {
    token: string;
}

export interface DeptInfo {
    ancestors: string;
    children: any[];
    createBy: string;
    createTime: string;
    delFlag: string;
    deptId: number;
    deptName: string;
    email: string;
    leader: string;
    orderNum: number;
    parentId: number;
    parentName: string;
    phone: string;
    remark: string;
    status: string;
    updateBy: string;
    updateTime: string;
}

interface UserInfoResponse {
    permissions: any[];
    roles: string[];
    user: SysUser;
}

// 登录
export function loginApi(params: LoginParams) {
    return post<LoginResponse>('/login', params);
}

// 获取登录信息
export function getUerInfoApi() {
    return get<UserInfoResponse>('/getInfo');
}
